package Plugin
{
	import Objects.GameObject;
	
	public class MultipleSelectPlugin extends GamePlugin
	{
		public var objects:Array=[];
		public function MultipleSelectPlugin()
		{
			super();
		}
		override protected function _update():void
		{
			var toRemove:Boolean=true;
			
			var index:int=0;
			while(index<objects.length)
			{
				var go:GameObject=objects[index];
				if(!go.removed)
				{
					toRemove=false;
				}
				if(go.mHit)
				{
					go.selected=!go.selected;
				}
				index++;
			}
			
			if(toRemove)
			{
				remove();
			}
		}
		public function selecteds():Array
		{
			return objects.filter(function (go:GameObject, index:int, arr:Array):Boolean{
				return go.selected;
			})
		}
	}
}